package company.bigo_F;

import leetcode.TreeNode;

public class BiGo2 {

    public int getDiameter(TreeNode node) {
        if (node == null)
            return 0;
        if (node.left == null && node.right == null)
            return node.val;
        return node.val + Math.max(getDiameter(node.left), getDiameter(node.right));
    }
}
